package class202205.demo25.demo24;


import java.util.Arrays;

class OuterClass{

}

public class demo20220524 {

    public static void main(String[] args) {
        int[][] array = {{1,2,3},{4,5,6}};
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j]+" ");
            }
            System.out.println();
        }

        System.out.println("使用foreach进行打印");
        for (int[] tmp:array) {
            System.out.println(tmp);
            for (int x: tmp) {
                System.out.print(x+" ");
            }
            System.out.println();
        }

        System.out.println("使用toString方法进行打印");
        //深度打印方法Arrays.deepToString()
        System.out.println(Arrays.deepToString(array));

    }

    public static void main1(String[] args) {
        //手动加花括号
        int[][] array = {{1,2,3},{4,5,6}};
        //也不能填数字
        int[][] array2 = new int[][]{{1,2,3},{4,5,6}};

        //不晓得数值情况  默认0
        int[][] array3 = new int[2][3];
    }
}